package com.daervin.idcenter;

public class Test {
    public static void main(String[] args) {
        final SnowflakeUtil snowflake = new SnowflakeUtil(0);

        Runnable r1 = new Runnable() {
            @Override
            public void run() {
                for (int i = 0; i < 10; i++) {
                    long id = snowflake.nextId();
                    System.out.println("r1: " + id);
//                    System.out.println(Long.toBinaryString(id));
                }
            }
        };

        Runnable r2 = new Runnable() {
            @Override
            public void run() {
                for (int i = 0; i < 20; i++) {
                    long id = snowflake.nextId();
                    System.out.println("r2: " + id);
//                    System.out.println(Long.toBinaryString(id));
                }
            }
        };

        Thread t1 = new Thread(r1);
        t1.start();

        Thread t2 = new Thread(r2);
        t2.start();

    }
}
